<?php 


function xbMail($mail,$connet)
{
	 $url = 'http://api.sendcloud.net/apiv2/mail/sendtemplate';
        $API_USER = 'daniuit';
        $API_KEY = 'z7XlUl0Q4u5QmyW0';
        $to = array('to'=>array('113664000@qq.com'));
        $headers= array('header1'=>'Content-Type: application/x-www-form-urlencoded');

        //不同于登录SendCloud站点的帐号，您需要登录后台创建发信子帐号，使用子帐号和密码才可以进行邮件的发送。
        $param = array(
            'apiUser' => $API_USER,
            'apiKey' => $API_KEY,
            'from' => 'phpstudy@mail.daniuit.com',
            'fromname' => 'PHP基础到高级实战交流',
            'to' => '545249324@qq.com',
            'subject' => '0基础学php开发技能',
            'templateInvokeName' => 'vip',
            'xsmtpapi' => json_encode($to),
            'headers'=>json_encode($headers),
            'useAddressList'=>'false');
        return xbsrequest($url,false,'POST',$param);
}

function xbsrequest($curl,$https = true,$method = 'GET',$data = null) {
        //var_dump($curl);
        $ch = curl_init();
        curl_setopt($ch,CURLOPT_URL,$curl);
        curl_setopt($ch,CURLOPT_HEADER,false);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
        if($https) {
            curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
            curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);
        }
        if($method == 'POST') {
            curl_setopt($ch,CURLOPT_POST,true);
            curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($data));
        }
        $content = curl_exec($ch);
        curl_close($ch);
        return $content;

}


function qqMail($mail,$connet)
{
	Vendor('PHPMailer.PHPMailerAutoload');

	$mail = new PHPMailer;

	//$mail->SMTPDebug = 3;                               // Enable verbose debug output

	$mail->isSMTP();                                      // Set mailer to use SMTP
	$mail->Host = 'smtp.qq.com';  // Specify main and backup SMTP servers
	$mail->SMTPAuth = true;                               // Enable SMTP authentication
	$mail->Username = '113664000@qq.com';                 // SMTP username
	$mail->Password = 'ukweceueldqebghc';                           // SMTP password
	$mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
	$mail->Port = 465;                                    // TCP port to connect to

	$mail->setFrom('113664000@qq.com', 'Mailer');
	$mail->addAddress('6955044@qq.com', 'Joe User');     // Add 
	$mail->addReplyTo('113664000@qq.com', 'Information');


	$mail->isHTML(true);                                  // Set email format to HTML

	$mail->Subject = '邮箱验证';
	$mail->Body    = $connet;

	if(!$mail->send()) {
	    echo 'Message could not be sent.';
	    echo 'Mailer Error: ' . $mail->ErrorInfo;
	} else {
	    echo 'Message has been sent';
	}
}


function FC($str='')
{
    // header("Content-type: text/html; charset=utf-8"); 

    Vendor('pscws4.pscws4#class');

    $pscws = new PSCWS4('utf8');

    // var_dump(__PUBLIC__);

    $pscws->set_dict('./Public/etc/dict.utf8.xdb');
    $pscws->set_rule('./Public/etc/rules.ini');

    $pscws->send_text($str);


    $tops = $pscws->get_tops(3, 'n,v');

    $tempArr = array();

   foreach ($tops as $word)
   {
      $tempArr[] = $word['word'];
   }

    return ($tempArr);
}

function qqlogin()
{
    Vendor('API.qqConnectAPI');
    $qc = new QC();
    $qc->qq_login();
}

function getQqOpenId()
{
    Vendor('API.qqConnectAPI');
    $qc = new QC();
    $qc->qq_callback();
    return $qc->get_openid();
}

function getQqUserInfo()
{
    Vendor('API.qqConnectAPI');
    $qc = new QC();
    return $qc->get_user_info();
}













 ?>